package com.example.tests;

public class ContactData implements Comparable<ContactData>{
	private String firstName;
	private String lastName;
	private String address;
	private String homePhone;
	private String mobilePhone;
	private String workPhone;
	private String email1;
	private String email2;
	private String bDay;
	private String bMonth;
	private String bYear;
	private String contactGroup;
	private String address2;
	private String phone2;
	private String id;

	public ContactData(String firsName, String lastName, String address,
			String homePhone, String mobilePhone, String workPhone,
			String email1, String email2, String bDay, String bMonth,
			String bYear, String contactGroup, String address2, String phone2) {
		this.firstName = firsName;
		this.lastName = lastName;
		this.address = address;
		this.homePhone = homePhone;
		this.mobilePhone = mobilePhone;
		this.workPhone = workPhone;
		this.email1 = email1;
		this.email2 = email2;
		this.bDay = bDay;
		this.bMonth = bMonth;
		this.bYear = bYear;
		this.contactGroup = contactGroup;
		this.address2 = address2;
		this.phone2 = phone2;
	}
	
	public ContactData() {
	}
	
	//@Override
	public ContactFromFormData toContactFromFormData() {
		ContactFromFormData contactFromForm = new ContactFromFormData()
			.withFirstName(firstName)
			.withLastName(lastName)
			.withAddress(address)
			.withHomePhone(homePhone)
			.withMobilePhone(mobilePhone)
			.withWorkPhone(workPhone)
			.withEmail1(email1)
			.withEmail2(email2)
			.withBDay(bDay)
			.withBMonth(bMonth)
			.withBYear(bYear)
			.withAddress2(address2)
			.withPhone2(phone2);
		return contactFromForm;
	}



	@Override
	public String toString() {
		return "ContactData [firstName=" + firstName + ", lastName=" + lastName
				+ ", homePhone=" + homePhone + ", email1=" + email1 + "]";
	}

	@Override
	public int compareTo(ContactData other) {
		int res = this.lastName.toLowerCase().compareTo(other.lastName.toLowerCase());
		if (res == 0) {
			res = this.firstName.toLowerCase().compareTo(other.firstName.toLowerCase());
		}
		return res;
	}

	@Override
	public int hashCode() {
		//final int prime = 31;
		int result = 1;
		//result = prime * result
		//		+ ((firstName == null) ? 0 : firstName.hashCode());
		//result = prime * result
		//		+ ((lastName == null) ? 0 : lastName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContactData other = (ContactData) obj;
		if (firstName == null) {
			if (other.firstName != null)
				return false;
		} else if (!firstName.equals(other.firstName))
			return false;
		if (lastName == null) {
			if (other.lastName != null)
				return false;
		} else if (!lastName.equals(other.lastName))
			return false;
		return true;
	}

	public ContactData withId(String id) {
		this.id = id;
		return this;
	}
	
	public ContactData withFirstName(String firstName) {
		this.firstName = firstName;
		return this;
	}

	public ContactData withLastName(String lastName) {
		this.lastName = lastName;
		return this;
	}

	public ContactData withAddress(String address) {
		this.address = address;
		return this;
	}

	public ContactData withAddress2(String address2) {
		this.address2 = address2;
		return this;
	}

	public ContactData withBYear(String bYear) {
		this.bYear = bYear;
		return this;
	}

	public ContactData withEmail1(String email1) {
		this.email1 = email1;
		return this;
	}

	public ContactData withEmail2(String email2) {
		this.email2 = email2;
		return this;
	}

	public ContactData withHomePhone(String homePhone) {
		this.homePhone = homePhone;
		return this;
	}

	public ContactData withMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
		return this;
	}

	public ContactData withPhone2(String phone2) {
		this.phone2 = phone2;
		return this;
	}

	public ContactData withWorkPhone(String workPhone) {
		this.workPhone = workPhone;
		return this;
	}

	public ContactData withContactGroup(String contactGroup) {
		this.contactGroup = contactGroup;
		return this;
	}

	public ContactData withBDay(String bDay) {
		this.bDay = bDay;
		return this;
	}

	public ContactData withBMonth(String bMonth) {
		this.bMonth = bMonth;
		return this;
	}

	public String getId() {
		return id;
	}
	
	public String getFirstName() {
		return firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public String getAddress() {
		return address;
	}

	public String getHomePhone() {
		return homePhone;
	}

	public String getMobilePhone() {
		return mobilePhone;
	}

	public String getWorkPhone() {
		return workPhone;
	}

	public String getEmail1() {
		return email1;
	}

	public String getEmail2() {
		return email2;
	}

	public String getbDay() {
		return bDay;
	}

	public String getbMonth() {
		return bMonth;
	}

	public String getbYear() {
		return bYear;
	}

	public String getContactGroup() {
		return contactGroup;
	}

	public String getAddress2() {
		return address2;
	}

	public String getPhone2() {
		return phone2;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public void setHomePhone(String homePhone) {
		this.homePhone = homePhone;
	}

	public void setMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
	}

	public void setWorkPhone(String workPhone) {
		this.workPhone = workPhone;
	}

	public void setEmail1(String email1) {
		this.email1 = email1;
	}

	public void setEmail2(String email2) {
		this.email2 = email2;
	}

	public void setbDay(String bDay) {
		this.bDay = bDay;
	}

	public void setbMonth(String bMonth) {
		this.bMonth = bMonth;
	}

	public void setbYear(String bYear) {
		this.bYear = bYear;
	}

	public void setContactGroup(String contactGroup) {
		this.contactGroup = contactGroup;
	}

	public void setAddress2(String address2) {
		this.address2 = address2;
	}

	public void setPhone2(String phone2) {
		this.phone2 = phone2;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	
}